import Vue from 'vue'
import Router from 'vue-router'

import Index from '@/components/homepage/Index'
import Homepage from '@/components/homepage/Homepage'
import Column from '@/components/homepage/Column'
import Notification from '@/components/notice/Index'
import Notice from '@/components/notice/Notice'
import Msg from '@/components/notice/Msg'
import MsgDetail from '@/components/notice/MsgDetail'
import Ask from '@/components/Ask'
import Wrapper from '@/components/Wrapper'
import Market from '@/components/market/Market'
import MarketHistory from '@/components/market/MarketHistory'
import User from '@/components/user/User'
import About from '@/components/user/UserAbout'
import Answer from '@/components/user/UserAnswer'
import Authentication from '@/components/user/UserAuthentication'
import History from '@/components/user/UserHistory'
import Info from '@/components/user/UserInfo'
import UserQuestion from '@/components/user/UserQuestion'
import QuestionEdit from '@/components/user/UserQuestionEdit'
import Recommend from '@/components/user/UserRecommend'
import Rule from '@/components/user/UserRule'
import Sett from '@/components/user/UserSet'
import Question from '@/components/question/Index'
import Search from '@/components/Search'


Vue.use(Router)

// 一级route加/（表示绝对路径）二级children route不加/（表示相对路径）
// 但是push的时候又要用绝对路径 比如 this.$router.push('/notification/msg');
export default new Router({
  base:'/assets/',
  routes: [{
      path: '/',
      name: 'index',
      component: Index,
      meta: { tier:1 },
      children: [{
      	path: '',
        name: 'homepage',
      	component: Homepage,
        meta: { footer:true,tier:1.1 }
      },{
      	path: 'column',
        name: 'column',
      	component: Column,
        meta: { footer:true,tier:1.2 }
      }]
    },{
      path: '/notification',
      name: 'notification',
      component: Notification,
      meta: { tier:2 },
      children: [{
        path: '',
        name: 'notice',
        component: Notice,
        meta: { footer:true,tier:2.1 }
      },{
        path: 'msg',
        name: 'msg',
        component: Msg,
        meta: { footer:true,tier:2.2 }
      },{
        path: 'msgDetail',
        component: MsgDetail,
        meta: {footer:true,tier:2.3 }
      }]
    },{
      path: '/msgDetail',
      component: MsgDetail,
      meta: {footer:false,tier:2.3 }
    },{
      path: '/ask',
      name:'ask',
      component: Ask,
      meta: {footer:false, tier:3}
    },{
      path: '/market',
      component: Wrapper,
      children: [{
        path: 'exchange',
        component: Market,
        meta: {footer:true, tier:4.1}
      },{
        path: 'history',
        component: MarketHistory,
        meta: {footer:false, tier:4.2}
      }]
    },{
      path:'/user',
      component: Wrapper,
      children: [{
        path: '',
        component: User,
        meta: {footer:true, tier:5.1}
      },{
        path: 'answer',
        component: Answer,
        meta: {footer:false, tier:5.2}
      },{
        path: 'authentication',
        component: Authentication,
        meta: {footer:false, tier:5.3}
      },{
        path: 'history',
        component: History,
        meta: {footer:false, tier:5.4}
      },{
        path: 'info',
        component: Info,
        meta: {footer:false, tier:5.5}
      },{
        path: 'question',
        component: UserQuestion,
        meta: {footer:false, tier:5.6}
      },{
        path: 'questionEdit',
        component: QuestionEdit,
        meta: {footer:false, tier:5.7}
      },{
        path: 'recommend',
        component: Recommend,
        meta: {footer:false, tier:5.8}
      },{
        path: 'rule',
        component: Rule,
        meta: {footer:false, tier:5.9}
      },{
        path: 'set',
        component: Sett,
        meta: {footer:false, tier:5.91}
      }]
    },{
      path: '/question',
      component: Question,
      meta: {footer:false, tier:6}
    },{
      path: '/search',
      component: Search,
      meta: {footer:false, tier:7}
    }]
})
